﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PServiceBus.Core.Interface {
    /// <summary>
    /// Interface used to identify an executable topic
    /// </summary>
    public interface IWorker {

        Dictionary<string, object> Parameter { get; set; }

        /// <summary>
        /// ID of topic that owns IWorker
        /// </summary>
        Guid TopicID { get; set; }

        /// <summary>
        /// How long to wait before execution
        /// </summary>
        TimeSpan RunInterval { get; set; }

        /// <summary>
        /// Context 
        /// Used to store information generated from calling execute
        /// </summary>
        List<Dictionary<string, object>> Context { get; set; }

        /// <summary>
        /// Execute code
        /// </summary>
        void Execute();

        /// <summary>
        /// Last Executed Date
        /// Used for evaluating RunInterval
        /// </summary>
        DateTime? ExecutionDate { get; set; }
    }
}
